package com.flyme.module.base.provider.listener;

import com.flyme.module.base.provider.service.SysDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.Ordered;

/**
 * @author: flyme
 * @date: 2019/2/12 16:24
 * @desc: 初始化字典
 */  
public class DicDataInitListener implements ApplicationListener<ApplicationReadyEvent>, Ordered {
    @Autowired
    private SysDictService dictService;
  
    
    @Override
    public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
        if (applicationReadyEvent.getApplicationContext().getDisplayName().indexOf("AnnotationConfigServletWebServerApplicationContext") > -1) {
           dictService.initDictRedis();
        }
    }
    
    @Override
    public int getOrder() {
        return 4;
    }
}
